<?php

use yii\db\Migration;

class m240417_014729_diandi_hotel_rim extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%diandi_hotel_rim}}', [
            'id' => "int(11) NOT NULL AUTO_INCREMENT",
            'bloc_id' => "int(11) NULL COMMENT '公司ID'",
            'store_id' => "int(11) NULL COMMENT '商户ID'",
            'hotel_id' => "int(11) NULL COMMENT '酒店ID'",
            'location_p' => "int(11) NULL COMMENT '省'",
            'location_c' => "int(11) NULL COMMENT '市'",
            'location_a' => "int(11) NULL COMMENT '区'",
            'room_id' => "int(11) NULL COMMENT '房间ID'",
            'room_num' => "int(11) NULL COMMENT '房间数量'",
            'rim_type' => "int(11) NULL COMMENT '周边类型'",
            'is_hot' => "int(11) NULL COMMENT '是否热门'",
            'title' => "varchar(100) NULL COMMENT '周边名称'",
            'thumb' => "varchar(255) NULL COMMENT '周边图片'",
            'thumbs' => "varchar(255) NULL COMMENT '周边相册'",
            'desc' => "varchar(255) NULL COMMENT '周边简介'",
            'content' => "text NULL COMMENT '周边详情'",
            'level_star' => "decimal(11,2) NULL COMMENT '星级'",
            'comment_num' => "int(11) NULL COMMENT '评价数量'",
            'lng' => "decimal(11,4) NULL",
            'lat' => "decimal(11,4) NULL",
            'create_time' => "datetime NULL COMMENT '创建时间'",
            'update_time' => "datetime NULL COMMENT '更新时间'",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='酒店周边'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%diandi_hotel_rim}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

